package com.yeyaomai.dksns.flowis.service.impl;

import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import com.yeyaomai.dksns.flowis.dao.LoginSessionDao;
import com.yeyaomai.dksns.flowis.domain.flowisdetail.FlowisQueryOrder;
import com.yeyaomai.dksns.flowis.domain.flowisdetail.LoginSession;
import com.yeyaomai.dksns.flowis.service.LoginSessionService;

@Service
public class LoginSessionServiceImpl implements LoginSessionService {

	@Resource
	private LoginSessionDao loginSessionDao;

	@Override
	public Page<LoginSession> getSplit(FlowisQueryOrder order) {
		Page<LoginSession> result = loginSessionDao.getSplit(order);
		List<LoginSession> list = result.getContent();
		for (Iterator<LoginSession> iterator = list.iterator(); iterator
				.hasNext();) {
			LoginSession loginSession = iterator.next();
			Integer distance = loginSessionDao
					.getLoginProfileBydkcode(loginSession.getUser_dkcode());
			loginSession.setDistance(distance);
		}
		return result;
	}

}
